package com.example.richman;
import java.util.ArrayList;

import com.syxy.dice.Dice;
import com.syxy.dice.MySurfaceView;

import uk.co.senab.photoview.PhotoViewAttacher;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Point;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.SystemClock;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.RelativeLayout.LayoutParams;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.ImageView.ScaleType;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.Display;
import android.view.Menu;
import android.view.MotionEvent;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnTouchListener;
import android.view.animation.TranslateAnimation;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;

public class GameMap extends Activity {

	MySurfaceView DiceView;
	ArrayList<Spriters> PlayerList=new ArrayList<Spriters>();
	
	public void onCreate(Bundle savedInstanceState)
    {
		
//	requestWindowFeature(Window.FEATURE_NO_TITLE);
//	this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
	
	super.onCreate(savedInstanceState);
    setContentView(R.layout.gamemap);
    

    
    
    
	DisplayMetrics mDisplayMetrics = new DisplayMetrics();
	getWindowManager().getDefaultDisplay().getMetrics(mDisplayMetrics);
	int W = mDisplayMetrics.widthPixels;
	int H = mDisplayMetrics.heightPixels;
	Log.i("Main", "Width = " + W);
	Log.i("Main", "Height = " + H);
    
	final RelativeLayout relativelaout=(RelativeLayout)this.findViewById(R.id.rela);
    DiceView = (MySurfaceView)findViewById(R.id.mySurfaceView1);
    DiceView.SetScreenParameter(W, H);
    
    

    
    
	final Spriters Player1=new Spriters(getApplicationContext(),relativelaout);
	Player1.setRoleTypeToImage(1);
    final Spriters Player2=new Spriters(getApplicationContext(),relativelaout);
    Player2.setRoleTypeToImage(2);
    final Spriters Player3=new Spriters(getApplicationContext(),relativelaout);
	Player3.setRoleTypeToImage(3);
	final Spriters Player4=new Spriters(getApplicationContext(),relativelaout);
	Player4.setRoleTypeToImage(4);
	 Player1.AdjustToScreen(W,H);
	 Player2.AdjustToScreen(W,H);
	 Player3.AdjustToScreen(W,H);
	 Player4.AdjustToScreen(W,H);
	    
    Player1.SetVisibleOnLayout();
    Player2.SetVisibleOnLayout();
    Player3.SetVisibleOnLayout();
    Player4.SetVisibleOnLayout();
    
    PlayerList.add(Player1);
    PlayerList.add(Player2);
    PlayerList.add(Player3);
    PlayerList.add(Player4);
    DiceView.SetPlaylist(PlayerList);
    
    
    ImageView Image=(ImageView)this.findViewById(R.id.gamemap);
    Image.setOnTouchListener(new OnTouchListener(){
    	

		

		@Override
		public boolean onTouch(View v, MotionEvent event) {
			Log.i("asd","tttttttt");
		/*	TranslateAnimation transAnima;
	    	transAnima = new TranslateAnimation(Player1.CurrentX, event.getX(),Player1.CurrentY ,event.getY());
	    	Player1.CurrentX=event.getX();
	    	Player1.CurrentY=event.getY();
	    	transAnima.setFillAfter(true);
	    	transAnima.setDuration(300);
	    	Player1.startAnimation(transAnima);
			// TODO Auto-generated method stub*/
			return false;
		}});
   
    
    
	
    }
	protected void onSaveInstanceState(Bundle outState) {  
        super.onSaveInstanceState(outState);  
        
    }  
	 

}
